-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[python-dateutil] Add missing stubs #14326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python-dateutil] Add missing stubs #14326
Conversation
donBarbos
commented
Jun 22, 2025
- Fix and improve few stubs
* Fix and improve few stubs
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
freq, | ||
dtstart: datetime.date | None = None, | ||
freq: Literal[0, 1, 2, 3, 4, 5, 6], | ||
dtstart: datetime.datetime | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old annotation was correct. rrule
converts a date
to a datetime
:
I'd also be fine with using datetime.datetime | datetime.date
. Although technically redundant, it's a bit clearer. (Also deriving datetime
from date
was a mistake, in my opinion.)
See also the prefect primer hits.
self, | ||
s: str, | ||
*, | ||
dtstart: datetime.datetime | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dtstart: datetime.datetime | None = None, | |
dtstart: datetime.date | None = None, |
See above.
The homeassistant primer hit is a bit unfortunate, but can easily be worked around with an explicit type annotation for the constant dict. |
Huh, new pyright errors. They seem legit, but strange that they're only appearing now. Probably due to a newer pyright version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, once you've squashed the new pyright errors.
Diff from mypy_primer, showing the effect of this PR on open source code: core (https://github.com/home-assistant/core)
+ homeassistant/components/habitica/util.py:81: error: Argument "freq" to "rrule" has incompatible type "int"; expected "Literal[0, 1, 2, 3, 4, 5, 6]" [arg-type]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/client/schemas/schedules.py:290: error: Argument 1 to "append" of "list" has incompatible type "rrule"; expected "rruleset" [arg-type]
|